package com.course.controller;

import com.course.component.http.Crp;
import com.course.component.http.requ.RequestSysArticles;
import com.course.component.http.requ.RequestCategory;
import com.course.component.http.requ.RequestNaves;
import com.course.component.http.requ.RequestSwiper;
import com.course.sysservers.SystemServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/x")
public class HomeController {

    @Autowired
    private SystemServer systemServer;


    //导航
    @RequestMapping("/navesList")
    @ResponseBody
    public Crp navesList(RequestNaves requestNaves) {
        return Crp.success(systemServer.naveList(requestNaves));
    }

    //轮播图
    @RequestMapping("/swiperList")
    @ResponseBody
    public Crp swiperList(RequestSwiper requestSwiper) {
        return Crp.success(systemServer.swiperList(requestSwiper));
    }

    //热门文章列表//首页推荐文章
    @RequestMapping("/artList")
    @ResponseBody
    public Crp artList(RequestSysArticles requestArticle) {
        return Crp.success(systemServer.artList(requestArticle));
    }

    //热门文章列表//首页推荐文章
    @RequestMapping("/artPage")
    @ResponseBody
    public Crp artPage(RequestSysArticles requestArticle) {
        return Crp.success(systemServer.artPage(requestArticle));
    }

    //分类列表
    @RequestMapping("/catList")
    @ResponseBody
    public Crp catList(RequestCategory requestCategory) {
        return Crp.success(systemServer.catList(requestCategory));
    }

    //文章详情
    @RequestMapping("/article")
    @ResponseBody
    public Crp article(RequestSysArticles requestArticle) {
        return Crp.success(systemServer.article(requestArticle));
    }

    //推荐信息
    @RequestMapping("/adds")
    @ResponseBody
    public Crp addslist(RequestSwiper requestSwiper) {
        return Crp.success(systemServer.addslist(requestSwiper));
    }
}
